package com.ldzg.blockwatcher.notify.factory;

import com.ldzg.blockwatcher.config.notify.NotifyProperties;
import com.ldzg.blockwatcher.notify.strategy.NotifyStrategy;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @author zhangyinhang
 * 通知策略接口
 */
@Component
@RequiredArgsConstructor
public class NotifyFactory {

    private final NotifyProperties notifyProperties;

    private final Map<String, NotifyStrategy> strategyMap;


    public NotifyStrategy getStrategy() {
        // 根据配置的策略，来调用不同的实现
        return strategyMap.get(notifyProperties.getType().getCode());
    }
}
